<template>
  <el-container class="main-container">
    <!--网页头部-->
    <el-header>
      <div class="left-box">
        <img src="../assets/img/logo/xiaomi.svg">
        <span></span>
      </div>
      <div class="right-box">
        <el-dropdown>
          <span class="el-dropdown-link">
            <img src="../assets/img/logo/hou1.svg" class="user-head">
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item icon="el-icon-user">个人信息</el-dropdown-item>
            <el-dropdown-item icon="el-icon-setting">个人设置</el-dropdown-item>
            <el-dropdown-item icon="el-icon-switch-button">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </el-header>
    <!--网页主体-->
    <el-container>
      <!--侧边栏-->
      <el-aside width="201px">
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="#ffffff"
          text-color="#444"
          active-text-color="#1989fa"
          :unique-opened="true"
          :router="true">
          <MenuTree :menuList="this.menuList"></MenuTree>
        </el-menu>
      </el-aside>
      <!--页面内容区-->
      <el-main>
        <!--路由视图-->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
  import MenuTree from '../components/MenuTree'

  export default {
    name: 'Main',
    data() {
      return {
        menuList:
        [
          {
            "id": 1,
            "parentId": 0,
            "menuName": "热门品牌",
            "url": "/mobile",
            "icon": "el-icon-mobile",
            "orderNum": 6,
            "open": 1,
            "disabled": false,
            "perms": null,
            "type": 0,
            "children": [
              {
                "id": 11,
                "parentId": 1,
                "menuName": "苹果",
                "url": "/apple",
                "icon": "",
                "orderNum": 1,
                "open": 0,
                "disabled": false,
                "perms": "login:log",
                "type": 0,
                "children": []
              },
              {
                "id": 12,
                "parentId": 1,
                "menuName": "三星",
                "url": "/samsung",
                "icon": "",
                "orderNum": 1,
                "open": 0,
                "disabled": false,
                "perms": "",
                "type": 0,
                "children": []
              },
              {
                "id": 13,
                "parentId": 1,
                "menuName": "华为",
                "url": "/huawei",
                "icon": "",
                "orderNum": 1,
                "open": 0,
                "disabled": false,
                "perms": "",
                "type": 0,
                "children": []
              },
              {
                "id": 14,
                "parentId": 1,
                "menuName": "小米",
                "url": "/xiaomi",
                "icon": "",
                "orderNum": 1,
                "open": 0,
                "disabled": false,
                "perms": "",
                "type": 0,
                "children": []
              }
            ]
          },
          {
            "id": 2,
            "parentId": 0,
            "menuName": "数据管理",
            "url": "/setting",
            "icon": "el-icon-setting",
            "orderNum": 6,
            "open": 0,
            "disabled": false,
            "perms": null,
            "type": 0,
            "children": [
              {
                "id": 21,
                "parentId": 2,
                "menuName": "机型管理",
                "url": "/mobilesetting",
                "icon": "",
                "orderNum": 1,
                "open": 0,
                "disabled": false,
                "perms": "",
                "type": 0,
                "children": []
              },
              {
                "id": 22,
                "parentId": 2,
                "menuName": "资讯管理",
                "url": "/newssetting",
                "icon": "",
                "orderNum": 1,
                "open": 0,
                "disabled": false,
                "perms": "",
                "type": 0,
                "children": []
              },
            ]
          },
          {
            "id": 3,
            "parentId": 0,
            "menuName": "科普知识",
            "url": "/knowledge",
            "icon": "el-icon-collection",
            "orderNum": 6,
            "open": 0,
            "disabled": true,
            "perms": null,
            "type": 0,
            "children": []
          },
          {
            "id": 4,
            "parentId": 0,
            "menuName": "数码资讯",
            "url": "/news",
            "icon": "el-icon-news",
            "orderNum": 6,
            "open": 0,
            "disabled": true,
            "perms": null,
            "type": 0,
            "children": []
          },
          {
            "id": 5,
            "parentId": 0,
            "menuName": "优惠活动",
            "url": "/sales",
            "icon": "el-icon-shopping-cart-1",
            "orderNum": 6,
            "open": 0,
            "disabled": true,
            "perms": null,
            "type": 0,
            "children": []
          },
          {
            "id": 6,
            "parentId": 0,
            "menuName": "交流论坛",
            "url": "/chat",
            "icon": "el-icon-chat-line-round",
            "orderNum": 6,
            "open": 0,
            "disabled": true,
            "perms": null,
            "type": 0,
            "children": []
          },
        ],
      };
    },
    methods: {
      handleOpen(){},
      handleClose(){}
    },
    components:{
      MenuTree
    },
  };
</script>

<style scoped>
  .main-container{
    height: 100%;
  }
  .el-header {
    background-color: #fdfdfd;
    color: #1989fa;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: #ffffff;
    color: #3d35358c;
    text-align: center;
    line-height: 200px;
    border-right: solid #eee8e85c 1px;
  }

  .el-main {
    background-color: #ffffff;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
  .left-box{
    width: 30%;
    height: 100%;
    position: relative;
    float: left;
    text-align: left;
    font-size: 21px;
    font-weight: bold;
  }
  .left-box img{
    width: auto;
    height: 40px;
    position: relative;
    float: left;
    top: 10px;
    left: 60px;
    margin-right: 10px;
  }
  .right-box{
    width: 10%;
    height: 100%;
    position: relative;
    float: right;
  }
  .user-head{
    width: auto;
    height: 50px;
    top: 5px;
    position: relative;
    float: right;
  }
</style>
